WPS Office.apk(点击下载) / aon.java


package defpackage;

import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.XMLFilterImpl;

/* renamed from: aon  reason: default package */
public final class aon extends XMLFilterImpl implements LexicalHandler {
    protected static final String[] aTS = {"http://xml.org/sax/properties/lexical-handler", "http://xml.org/sax/handlers/LexicalHandler"};
    protected static final aof aTT = new aof();
    private boolean aTU;
    protected ano aTV;
    private boolean aTW;
    protected boolean aTX;
    protected Writer aTY;
    private aof aTZ;
    private apg aTe;
    private boolean aUa;
    private int aUb;
    private StringBuffer aUc;
    private boolean aUd;
    private boolean aUe;
    private LexicalHandler aUf;
    private boolean aUg;
    private boolean aUh;
    private Map<String, String> aUi;
    private int aUj;
    private char lastChar;

    public aon() {
        this.aTU = true;
        this.aTW = false;
        this.aTX = false;
        this.aTe = new apg();
        this.aUa = true;
        this.aUb = 0;
        this.aUc = new StringBuffer();
        this.aUd = false;
        this.aTZ = aTT;
        this.aTY = new BufferedWriter(new OutputStreamWriter(System.out));
        this.aUe = true;
        this.aTe.d(anl.aRP);
    }

    public aon(aof aof) throws UnsupportedEncodingException {
        this.aTU = true;
        this.aTW = false;
        this.aTX = false;
        this.aTe = new apg();
        this.aUa = true;
        this.aUb = 0;
        this.aUc = new StringBuffer();
        this.aUd = false;
        this.aTZ = aof;
        this.aTY = a(System.out, aof.aSR);
        this.aUe = true;
        this.aTe.d(anl.aRP);
    }

    public aon(OutputStream outputStream) throws UnsupportedEncodingException {
        this.aTU = true;
        this.aTW = false;
        this.aTX = false;
        this.aTe = new apg();
        this.aUa = true;
        this.aUb = 0;
        this.aUc = new StringBuffer();
        this.aUd = false;
        this.aTZ = aTT;
        this.aTY = a(outputStream, this.aTZ.aSR);
        this.aUe = true;
        this.aTe.d(anl.aRP);
    }

    public aon(OutputStream outputStream, aof aof) throws UnsupportedEncodingException {
        this.aTU = true;
        this.aTW = false;
        this.aTX = false;
        this.aTe = new apg();
        this.aUa = true;
        this.aUb = 0;
        this.aUc = new StringBuffer();
        this.aUd = false;
        this.aTZ = aof;
        this.aTY = a(outputStream, aof.aSR);
        this.aUe = true;
        this.aTe.d(anl.aRP);
    }

    public aon(Writer writer) {
        this(writer, aTT);
    }

    public aon(Writer writer, aof aof) {
        this.aTU = true;
        this.aTW = false;
        this.aTX = false;
        this.aTe = new apg();
        this.aUa = true;
        this.aUb = 0;
        this.aUc = new StringBuffer();
        this.aUd = false;
        this.aTY = writer;
        this.aTZ = aof;
        this.aTe.d(anl.aRP);
    }

    private void IB() throws IOException {
        String str = this.aTZ.aST;
        if (str != null && str.length() > 0) {
            for (int i = 0; i < this.aUb; i++) {
                this.aTY.write(str);
            }
        }
    }

    private void IC() throws IOException {
        if (this.aTZ.aSV) {
            this.aTY.write(this.aTZ.aSW);
        }
    }

    private void ID() throws IOException {
        String str = this.aTZ.aSR;
        if (!this.aTZ.aSP) {
            if (str.equals("UTF8")) {
                this.aTY.write("<?xml version=\"1.0\"");
                if (!this.aTZ.aSS) {
                    this.aTY.write(" encoding=\"UTF-8\"");
                }
                this.aTY.write("?>");
            } else {
                this.aTY.write("<?xml version=\"1.0\"");
                if (!this.aTZ.aSS) {
                    this.aTY.write(" encoding=\"" + str + "\"");
                }
                this.aTY.write("?>");
            }
            if (this.aTZ.aSQ) {
                println();
            }
        }
    }

    private static Writer a(OutputStream outputStream, String str) throws UnsupportedEncodingException {
        return new BufferedWriter(new OutputStreamWriter(outputStream, str));
    }

    private static void a(IOException iOException) throws SAXException {
        throw new SAXException(iOException);
    }

    private void b(anl anl) throws IOException {
        if (anl != null) {
            p(anl.aRQ, anl.uri);
        }
    }

    private void c(anm anm) throws IOException {
        switch (anm.Io()) {
            case ELEMENT_NODE:
                d((ang) anm);
                return;
            case ATTRIBUTE_NODE:
                amz amz = (amz) anm;
                this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                this.aTY.write(amz.Id());
                this.aTY.write("=");
                char c = this.aTZ.aTb;
                this.aTY.write(c);
                cE(amz.getValue());
                this.aTY.write(c);
                this.aTV = ano.ATTRIBUTE_NODE;
                return;
            case TEXT_NODE:
                String text = anm.getText();
                if (text != null && text.length() > 0) {
                    if (this.aUa) {
                        text = cD(text);
                    }
                    this.aTV = ano.TEXT_NODE;
                    this.aTY.write(text);
                    return;
                }
                return;
            case CDATA_SECTION_NODE:
                String text2 = anm.getText();
                this.aTY.write("<![CDATA[");
                if (text2 != null) {
                    this.aTY.write(text2);
                }
                this.aTY.write("]]>");
                this.aTV = ano.CDATA_SECTION_NODE;
                return;
            case ENTITY_REFERENCE_NODE:
                anj anj = (anj) anm;
                if (!this.aTU) {
                    cB(anj.getName());
                    return;
                } else {
                    this.aTY.write(anj.getText());
                    return;
                }
            case PROCESSING_INSTRUCTION_NODE:
                anp anp = (anp) anm;
                this.aTY.write("<?");
                this.aTY.write(anp.getName());
                this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                this.aTY.write(anp.getText());
                this.aTY.write("?>");
                IC();
                this.aTV = ano.PROCESSING_INSTRUCTION_NODE;
                return;
            case COMMENT_NODE:
                cC(anm.getText());
                return;
            case DOCUMENT_NODE:
                b((and) anm);
                return;
            case NAMESPACE_NODE:
                return;
            default:
                throw new IOException("Invalid node type: " + anm);
        }
    }

    private boolean c(anl anl) {
        String str;
        if (!(anl == null || anl == anl.aRO || (str = anl.uri) == null || str.length() <= 0)) {
            apg apg = this.aTe;
            String str2 = anl.aRQ;
            anl IQ = (str2 == null || str2.length() == 0) ? apg.IQ() : apg.cI(str2);
            if (!(IQ == null ? false : IQ == anl ? true : anl.uri.equals(IQ.uri))) {
                return true;
            }
        }
        return false;
    }

    private void cB(String str) throws IOException {
        this.aTY.write("&");
        this.aTY.write(str);
        this.aTY.write(";");
        this.aTV = ano.ENTITY_REFERENCE_NODE;
    }

    private void cC(String str) throws IOException {
        if (this.aTZ.aSV) {
            println();
            IB();
        }
        this.aTY.write("<!--");
        this.aTY.write(str);
        this.aTY.write("-->");
        this.aTV = ano.COMMENT_NODE;
    }

    private String cD(String str) {
        String str2;
        String replaceAll = str.replaceAll("[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]", "");
        int length = replaceAll.length();
        int i = 0;
        char[] cArr = null;
        int i2 = 0;
        while (i2 < length) {
            char charAt = replaceAll.charAt(i2);
            switch (charAt) {
                case '\t':
                case '\n':
                case '\r':
                    if (this.aTX) {
                        str2 = String.valueOf(charAt);
                        break;
                    }
                    str2 = null;
                    break;
                case '&':
                    str2 = "&amp;";
                    break;
                case '<':
                    str2 = "&lt;";
                    break;
                case '>':
                    str2 = "&gt;";
                    break;
                default:
                    if (charAt < ' ' || g(charAt)) {
                        str2 = "&#" + ((int) charAt) + ";";
                        break;
                    }
                    str2 = null;
                    break;
            }
            if (str2 != null) {
                if (cArr == null) {
                    cArr = replaceAll.toCharArray();
                }
                this.aUc.append(cArr, i, i2 - i);
                this.aUc.append(str2);
                i = i2 + 1;
            }
            i2++;
            i = i;
            cArr = cArr;
        }
        if (i == 0) {
            return replaceAll;
        }
        if (i < length) {
            if (cArr == null) {
                cArr = replaceAll.toCharArray();
            }
            this.aUc.append(cArr, i, i2 - i);
        }
        String stringBuffer = this.aUc.toString();
        this.aUc.setLength(0);
        return stringBuffer;
    }

    private void cE(String str) throws IOException {
        String str2;
        if (str != null) {
            char c = this.aTZ.aTb;
            int length = str.length();
            int i = 0;
            int i2 = 0;
            char[] cArr = null;
            while (i2 < length) {
                char charAt = str.charAt(i2);
                switch (charAt) {
                    case '\t':
                    case '\n':
                    case '\r':
                        str2 = null;
                        break;
                    case '\"':
                        if (c == '\"') {
                            str2 = "&quot;";
                            break;
                        }
                        str2 = null;
                        break;
                    case '&':
                        str2 = "&amp;";
                        break;
                    case '\'':
                        if (c == '\'') {
                            str2 = "&apos;";
                            break;
                        }
                        str2 = null;
                        break;
                    case '<':
                        str2 = "&lt;";
                        break;
                    case '>':
                        str2 = "&gt;";
                        break;
                    default:
                        if (charAt < ' ' || g(charAt)) {
                            str2 = "&#" + ((int) charAt) + ";";
                            break;
                        }
                        str2 = null;
                        break;
                }
                if (str2 != null) {
                    if (cArr == null) {
                        cArr = str.toCharArray();
                    }
                    this.aUc.append(cArr, i, i2 - i);
                    this.aUc.append(str2);
                    i = i2 + 1;
                }
                i2++;
                cArr = cArr;
                i = i;
            }
            if (i != 0) {
                if (i < length) {
                    if (cArr == null) {
                        cArr = str.toCharArray();
                    }
                    this.aUc.append(cArr, i, i2 - i);
                }
                str = this.aUc.toString();
                this.aUc.setLength(0);
            }
            this.aTY.write(str);
        }
    }

    private void d(ang ang) throws IOException {
        boolean z;
        int Ie = ang.Ie();
        String Id = ang.Id();
        IC();
        IB();
        this.aTY.write("<");
        this.aTY.write(Id);
        int size = this.aTe.aUU.size();
        anl anl = new anl(ang.Ic(), ang.getNamespaceURI());
        if (c(anl)) {
            this.aTe.d(anl);
            b(anl);
        }
        boolean z2 = true;
        int i = 0;
        while (i < Ie) {
            anm gn = ang.gn(i);
            if (gn instanceof anl) {
                anl anl2 = (anl) gn;
                if (c(anl2)) {
                    this.aTe.d(anl2);
                    b(anl2);
                }
                z = z2;
            } else {
                z = gn instanceof ang ? false : gn instanceof anc ? false : z2;
            }
            i++;
            z2 = z;
        }
        int Il = ang.Il();
        for (int i2 = 0; i2 < Il; i2++) {
            amz go = ang.go(i2);
            anl anl3 = new anl(go.Ic(), go.getNamespaceURI());
            if (!anl3.equals(anl.aRP) && anl3.equals(anl.aRO)) {
                anl cI = this.aTe.cI(anl3.aRQ);
                if (!anl3.uri.equals(cI != null ? cI.uri : null)) {
                    b(anl3);
                    this.aTe.d(anl3);
                }
            }
            String name = go.getName();
            if (name.startsWith("xmlns:")) {
                String substring = name.substring(6);
                if (this.aTe.cI(substring) == null) {
                    String value = go.getValue();
                    this.aTe.t(substring, value);
                    p(substring, value);
                }
            } else if (!name.equals("xmlns")) {
                char c = this.aTZ.aTb;
                this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                this.aTY.write(go.Id());
                this.aTY.write("=");
                this.aTY.write(c);
                cE(go.getValue());
                this.aTY.write(c);
            } else if (this.aTe.IQ() == null) {
                String value2 = go.getValue();
                this.aTe.t(null, value2);
                p(null, value2);
            }
        }
        this.aTV = ano.ELEMENT_NODE;
        if (Ie > 0) {
            this.aTY.write(">");
            if (z2) {
                e(ang);
            } else {
                this.aUb++;
                e(ang);
                this.aUb--;
                IC();
                IB();
            }
            this.aTY.write("</");
            this.aTY.write(Id);
            this.aTY.write(">");
        } else if (!this.aTZ.aSU) {
            this.aTY.write("/>");
        } else {
            this.aTY.write("></");
            this.aTY.write(Id);
            this.aTY.write(">");
        }
        while (this.aTe.aUU.size() > size) {
            this.aTe.IP();
        }
        this.aTV = ano.ELEMENT_NODE;
    }

    private void e(ang ang) throws IOException {
        StringBuffer stringBuffer;
        anq anq;
        boolean z;
        char c;
        boolean z2 = true;
        int i = 0;
        boolean z3 = this.aTZ.aSX;
        boolean z4 = this.aTX;
        if (z3) {
            amz cu = ang.cu("space");
            boolean z5 = this.aTX;
            if (cu != null) {
                z5 = "xml".equals(cu.Ic()) && "preserve".equals(cu.getText());
            }
            this.aTX = z5;
            z3 = !this.aTX;
        }
        if (z3) {
            int Ie = ang.Ie();
            int i2 = 0;
            StringBuffer stringBuffer2 = null;
            anq anq2 = null;
            while (i2 < Ie) {
                anm gn = ang.gn(i2);
                if (!(gn instanceof anq)) {
                    if (!z2 && this.aTZ.aSY) {
                        if (Character.isWhitespace(stringBuffer2 != null ? stringBuffer2.charAt(0) : anq2 != null ? anq2.getText().charAt(0) : 'a')) {
                            this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                        }
                    }
                    if (anq2 != null) {
                        if (stringBuffer2 != null) {
                            writeString(stringBuffer2.toString());
                            stringBuffer2 = null;
                        } else {
                            writeString(anq2.getText());
                        }
                        if (this.aTZ.aSY) {
                            if (stringBuffer2 != null) {
                                c = stringBuffer2.charAt(stringBuffer2.length() - 1);
                            } else if (anq2 != null) {
                                String text = anq2.getText();
                                c = text.charAt(text.length() - 1);
                            } else {
                                c = 'a';
                            }
                            if (Character.isWhitespace(c)) {
                                this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                            }
                        }
                        stringBuffer = stringBuffer2;
                        anq = null;
                    } else {
                        stringBuffer = stringBuffer2;
                        anq = anq2;
                    }
                    c(gn);
                    z = false;
                } else if (anq2 == null) {
                    stringBuffer = stringBuffer2;
                    anq = (anq) gn;
                    z = z2;
                } else {
                    if (stringBuffer2 == null) {
                        stringBuffer2 = new StringBuffer(anq2.getText());
                    }
                    stringBuffer2.append(((anq) gn).getText());
                    z = z2;
                    stringBuffer = stringBuffer2;
                    anq = anq2;
                }
                i2++;
                anq2 = anq;
                stringBuffer2 = stringBuffer;
                z2 = z;
            }
            if (anq2 != null) {
                if (!z2 && this.aTZ.aSY) {
                    if (Character.isWhitespace(stringBuffer2 != null ? stringBuffer2.charAt(0) : anq2.getText().charAt(0))) {
                        this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                    }
                }
                if (stringBuffer2 != null) {
                    writeString(stringBuffer2.toString());
                } else {
                    writeString(anq2.getText());
                }
            }
        } else {
            int Ie2 = ang.Ie();
            anm anm = null;
            while (i < Ie2) {
                anm gn2 = ang.gn(i);
                if (gn2 instanceof anq) {
                    c(gn2);
                } else {
                    if (anm != null && this.aTZ.aSY) {
                        String text2 = anm.getText();
                        if (Character.isWhitespace(text2.charAt(text2.length() - 1))) {
                            this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                        }
                    }
                    c(gn2);
                    gn2 = null;
                }
                i++;
                anm = gn2;
            }
        }
        this.aTX = z4;
    }

    private boolean g(char c) {
        if (this.aUj == 0) {
            String str = this.aTZ.aSR;
            this.aUj = (str == null || !str.equals("US-ASCII")) ? -1 : 127;
        }
        int i = this.aUj;
        return i > 0 && c > i;
    }

    private void p(String str, String str2) throws IOException {
        if (str == null || str.length() <= 0) {
            this.aTY.write(" xmlns=\"");
        } else {
            this.aTY.write(" xmlns:");
            this.aTY.write(str);
            this.aTY.write("=\"");
        }
        this.aTY.write(str2);
        this.aTY.write("\"");
    }

    private void println() throws IOException {
        this.aTY.write(this.aTZ.aSW);
    }

    private void writeString(String str) throws IOException {
        if (str != null && str.length() > 0) {
            if (this.aUa) {
                str = cD(str);
            }
            if (this.aTZ.aSX) {
                boolean z = true;
                StringTokenizer stringTokenizer = new StringTokenizer(str);
                while (stringTokenizer.hasMoreTokens()) {
                    String nextToken = stringTokenizer.nextToken();
                    if (z) {
                        z = false;
                        if (this.aTV != ano.TEXT_NODE) {
                            this.aTY.write(nextToken);
                            this.aTV = ano.TEXT_NODE;
                        }
                    }
                    this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                    this.aTY.write(nextToken);
                    this.aTV = ano.TEXT_NODE;
                }
                return;
            }
            this.aTV = ano.TEXT_NODE;
            this.aTY.write(str);
        }
    }

    public final void b(and and) throws IOException {
        ID();
        int Ie = and.Ie();
        for (int i = 0; i < Ie; i++) {
            c(and.gn(i));
        }
        IC();
        if (this.aUe) {
            this.aTY.flush();
        }
    }

    public final void c(ang ang) throws IOException {
        d(ang);
        if (this.aUe) {
            this.aTY.flush();
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void characters(char[] cArr, int i, int i2) throws SAXException {
        if (cArr != null && cArr.length != 0 && i2 > 0) {
            try {
                String valueOf = String.valueOf(cArr, i, i2);
                String cD = this.aUa ? cD(valueOf) : valueOf;
                if (this.aTZ.aSX) {
                    if (this.aTV == ano.TEXT_NODE && !this.aUd) {
                        this.aTY.write(32);
                    } else if (this.aUd && Character.isWhitespace(this.lastChar)) {
                        this.aTY.write(32);
                    } else if (this.aTV == ano.ELEMENT_NODE && this.aTZ.aSY && this.aTW && Character.isWhitespace(cArr[0])) {
                        this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                    }
                    String str = "";
                    StringTokenizer stringTokenizer = new StringTokenizer(cD);
                    while (stringTokenizer.hasMoreTokens()) {
                        this.aTY.write(str);
                        this.aTY.write(stringTokenizer.nextToken());
                        str = MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR;
                    }
                } else {
                    this.aTY.write(cD);
                }
                this.aUd = true;
                this.lastChar = cArr[(i + i2) - 1];
                this.aTV = ano.TEXT_NODE;
                super.characters(cArr, i, i2);
            } catch (IOException e) {
                a(e);
            }
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void comment(char[] cArr, int i, int i2) throws SAXException {
        if (this.aUg || !this.aUh) {
            try {
                this.aUd = false;
                cC(new String(cArr, i, i2));
            } catch (IOException e) {
                a(e);
            }
        }
        if (this.aUf != null) {
            this.aUf.comment(cArr, i, i2);
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void endCDATA() throws SAXException {
        try {
            this.aTY.write("]]>");
        } catch (IOException e) {
            a(e);
        }
        if (this.aUf != null) {
            this.aUf.endCDATA();
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void endDTD() throws SAXException {
        this.aUh = false;
        if (this.aUf != null) {
            this.aUf.endDTD();
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void endDocument() throws SAXException {
        super.endDocument();
        if (this.aUe) {
            try {
                this.aTY.flush();
            } catch (IOException e) {
            }
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void endElement(String str, String str2, String str3) throws SAXException {
        try {
            this.aUd = false;
            this.aUb--;
            if (this.aTW) {
                IC();
                IB();
            }
            this.aTY.write("</");
            this.aTY.write(str3);
            this.aTY.write(">");
            this.aTV = ano.ELEMENT_NODE;
            this.aTW = true;
            super.endElement(str, str2, str3);
        } catch (IOException e) {
            a(e);
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void endEntity(String str) throws SAXException {
        if (this.aUf != null) {
            this.aUf.endEntity(str);
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void endPrefixMapping(String str) throws SAXException {
        super.endPrefixMapping(str);
    }

    public final void flush() throws IOException {
        this.aTY.flush();
    }

    @Override // org.xml.sax.XMLReader, org.xml.sax.helpers.XMLFilterImpl
    public final Object getProperty(String str) throws SAXNotRecognizedException, SAXNotSupportedException {
        for (int i = 0; i < aTS.length; i++) {
            if (aTS[i].equals(str)) {
                return this.aUf;
            }
        }
        return super.getProperty(str);
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void ignorableWhitespace(char[] cArr, int i, int i2) throws SAXException {
        super.ignorableWhitespace(cArr, i, i2);
    }

    @Override // org.xml.sax.DTDHandler, org.xml.sax.helpers.XMLFilterImpl
    public final void notationDecl(String str, String str2, String str3) throws SAXException {
        super.notationDecl(str, str2, str3);
    }

    @Override // org.xml.sax.XMLReader, org.xml.sax.helpers.XMLFilterImpl
    public final void parse(InputSource inputSource) throws IOException, SAXException {
        XMLReader parent = getParent();
        if (parent == null) {
            throw new NullPointerException("No parent for filter");
        }
        for (int i = 0; i < aTS.length; i++) {
            try {
                parent.setProperty(aTS[i], this);
                break;
            } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
            }
        }
        super.parse(inputSource);
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void processingInstruction(String str, String str2) throws SAXException {
        try {
            IB();
            this.aTY.write("<?");
            this.aTY.write(str);
            this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
            this.aTY.write(str2);
            this.aTY.write("?>");
            IC();
            this.aTV = ano.PROCESSING_INSTRUCTION_NODE;
            super.processingInstruction(str, str2);
        } catch (IOException e) {
            a(e);
        }
    }

    public final void setDocumentLocator(Locator locator) {
        super.setDocumentLocator(locator);
    }

    @Override // org.xml.sax.XMLReader, org.xml.sax.helpers.XMLFilterImpl
    public final void setProperty(String str, Object obj) throws SAXNotRecognizedException, SAXNotSupportedException {
        for (int i = 0; i < aTS.length; i++) {
            if (aTS[i].equals(str)) {
                LexicalHandler lexicalHandler = (LexicalHandler) obj;
                if (lexicalHandler == null) {
                    throw new NullPointerException("Null lexical handler");
                }
                this.aUf = lexicalHandler;
                return;
            }
        }
        super.setProperty(str, obj);
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void startCDATA() throws SAXException {
        try {
            this.aTY.write("<![CDATA[");
        } catch (IOException e) {
            a(e);
        }
        if (this.aUf != null) {
            this.aUf.startCDATA();
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void startDTD(String str, String str2, String str3) throws SAXException {
        boolean z = true;
        this.aUh = true;
        try {
            this.aTY.write("<!DOCTYPE ");
            this.aTY.write(str);
            if (str2 == null || str2.equals("")) {
                z = false;
            } else {
                this.aTY.write(" PUBLIC \"");
                this.aTY.write(str2);
                this.aTY.write("\"");
            }
            if (str3 != null && !str3.equals("")) {
                if (!z) {
                    this.aTY.write(" SYSTEM");
                }
                this.aTY.write(" \"");
                this.aTY.write(str3);
                this.aTY.write("\"");
            }
            this.aTY.write(">");
            IC();
        } catch (IOException e) {
            a(e);
        }
        if (this.aUf != null) {
            this.aUf.startDTD(str, str2, str3);
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void startDocument() throws SAXException {
        try {
            ID();
            super.startDocument();
        } catch (IOException e) {
            a(e);
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void startElement(String str, String str2, String str3, Attributes attributes) throws SAXException {
        try {
            this.aUd = false;
            IC();
            IB();
            this.aTY.write("<");
            this.aTY.write(str3);
            if (this.aUi != null) {
                for (Map.Entry<String, String> entry : this.aUi.entrySet()) {
                    p(entry.getKey(), entry.getValue());
                }
                this.aUi = null;
            }
            int length = attributes.getLength();
            for (int i = 0; i < length; i++) {
                char c = this.aTZ.aTb;
                this.aTY.write(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
                this.aTY.write(attributes.getQName(i));
                this.aTY.write("=");
                this.aTY.write(c);
                cE(attributes.getValue(i));
                this.aTY.write(c);
            }
            this.aTY.write(">");
            this.aUb++;
            this.aTV = ano.ELEMENT_NODE;
            this.aTW = false;
            super.startElement(str, str2, str3, attributes);
        } catch (IOException e) {
            a(e);
        }
    }

    @Override // org.xml.sax.ext.LexicalHandler
    public final void startEntity(String str) throws SAXException {
        try {
            cB(str);
        } catch (IOException e) {
            a(e);
        }
        if (this.aUf != null) {
            this.aUf.startEntity(str);
        }
    }

    @Override // org.xml.sax.helpers.XMLFilterImpl, org.xml.sax.ContentHandler
    public final void startPrefixMapping(String str, String str2) throws SAXException {
        if (this.aUi == null) {
            this.aUi = new HashMap();
        }
        this.aUi.put(str, str2);
        super.startPrefixMapping(str, str2);
    }

    @Override // org.xml.sax.DTDHandler, org.xml.sax.helpers.XMLFilterImpl
    public final void unparsedEntityDecl(String str, String str2, String str3, String str4) throws SAXException {
        super.unparsedEntityDecl(str, str2, str3, str4);
    }
}